<?php foreach($sps as $sp): ?>
<div idsp="<?php echo $sp['MaSanPham']?>" class="sanphammoi">
    <img src="<?=base_url('images/moi.gif')?>" style="float: right;" />
<?php if($sp['AnhSanPham'] ==null || $sp['AnhSanPham']=='') $sp['AnhSanPham']='noimage.jpg'?>
    <img class="anhnew" src="<?=base_url('images/product/'.$sp['AnhSanPham'])?>" /></br>
    <span class="tensanpham"><?php echo $sp['TenSanPham']?></span><br />
    <span class="giaban"><?php echo number_format($sp['GiaBan'])?>VND</span>
</div>
<?php endforeach; ?>
<script>
    $('.sanphammoi').click(function(){
        var masp = $(this).attr('idsp');
        $.ajax({
            type:'POST',
            url:'<?=base_url('index.php/sanpham_controller/chitietsanpham')?>',
            data: {masp:masp},
            success: function(data){
                $('.content').html(data);
            }
        });
    });
</script>